#include <QPainter>
#include <QImage>
#include "drawimage.h"

DrawImage::DrawImage(QWidget *parent, int num) :
    DisplayWidget(parent),
    screenNo(num)
{
    pX = parent->width();
    pY = parent->height();
}

DrawImage::DrawImage(QWidget *parent, QString path, int num):
    DisplayWidget(parent),
    iPath(path),
    screenNo(num)
{
    pX = parent->width();
    pY = parent->height();
}

DrawImage::~DrawImage()
{

}

void DrawImage::setImagePath(const QString imagePath)
{
    iPath = imagePath;
}

void DrawImage::paintEvent(QPaintEvent *pEvent)
{
    Q_UNUSED(pEvent);
    drawImage();
}

void DrawImage::drawImage()
{
    //TODO
    this->setAutoFillBackground(true);
    QPalette palette;
    palette.setColor(QPalette::Background, QColor(0,0,0));
    this->setPalette(palette);

    QPainter painter(this);
    QImage myImage(iPath);
    painter.drawImage(0,0, myImage, 0,0, myImage.width(), myImage.height());
}
